package com.sskj.xyft.market;

import com.sskj.base.utils.RxUtils;
import com.sskj.xyft.BasePresenter;
import com.sskj.xyft.api.Api;
import com.sskj.xyft.api.ApiObserver;
import com.sskj.xyft.message.data.MessageData;

public class NoticeListPresenter extends BasePresenter<NoticeListActivity> {
    public void getNoticeList(String account, int page, int pageSize, boolean showLoading) {
        Api.getInstance().getNoticeList(page, pageSize)
                .compose(RxUtils.transform())
                .subscribe(new ApiObserver<MessageData>(this, showLoading) {
                    @Override
                    public void onSuccess(MessageData data) {
                        mView.setData(data);
                    }

                    @Override
                    public void onError(Throwable e) {
                        super.onError(e);
                        mView.setData(null);
                    }

                    @Override
                    public void onComplete() {
                        super.onComplete();
                        mView.finishRefresh();
                    }
                });
    }
}
